﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="MappingGroupItemStyle"
           TargetType="{x:Type GroupItem}">
        <Setter Property="Margin"
                Value="10 0 10 20" />
        <Setter Property="Width"
                Value="200" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupItem}">
                    <Border Background="Red">
                        <StackPanel>
                            <TextBlock Padding="5"
                                       FontWeight="Bold"
                                       Text="{Binding Path=Name}"
                                       Foreground="White" />
                            <ItemsPresenter />
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MappingListHeaderStyle"
           TargetType="TextBlock">
        <Setter Property="FontWeight"
                Value="UltraBold" />
        <Setter Property="FontSize"
                Value="11" />
        <Setter Property="Margin"
                Value="25 5 0 15" />
    </Style>

    <Style x:Key="MappingListItemStyle"
           TargetType="ListBoxItem">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".35" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="fillColor2"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To=".75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="fillColor"
                                   Opacity="0"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False" />
                        <Rectangle x:Name="fillColor2"
                                   Opacity="0"
                                   Fill="#FFBADDE9"
                                   IsHitTestVisible="False" />
                        <ContentPresenter x:Name="contentPresenter"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}" />
                        <Rectangle x:Name="FocusVisualElement"
                                   Stroke="#FF6DBDD1"
                                   StrokeThickness="1"
                                   Visibility="Collapsed"
                                   RadiusX="1"
                                   RadiusY="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MappingListStyle"
           TargetType="ListBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <DockPanel>
                        <TextBlock DockPanel.Dock="Top"
                                   Style="{StaticResource MappingListHeaderStyle}">
                            <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Items.Count}" />
                            <TextBlock Text="ACTIVE MAPPINGS" />
                        </TextBlock>
                        <ScrollViewer Margin="15 0 0 0"
                                      Style="{StaticResource ListScrollViewerStyle}"
                                      HorizontalScrollBarVisibility="Disabled">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemContainerStyle"
                Value="{StaticResource MappingListItemStyle}" />
    </Style>
</ResourceDictionary>